axios.defaults.baseURL = "http://www.itcbc.com:8000";
axios.interceptors.request.use(
    function (config) {
      NProgress.start(); // 显示加载中
      if (localStorage.getItem("cms90")) {
        config.headers.Authorization= localStorage.getItem("cms90")
      }
      return config;
    },
    function (error) {
      return Promise.reject(error);
    }
  );
  
  axios.interceptors.response.use(
    function (response) {
      NProgress.done(); // 关闭加载中
      if (response.data.code!==0&&response.data.code!==undefined) {
        toastr.error(response.data.message)
      }
      return response;
    },
    function (error) {
      NProgress.done(); // 关闭加载中
      toastr.error(error.response.data.message)
      if (error.response.status === 401) {
        window.top.location.href = "login.html";
      }
      return Promise.reject(error);
    }
  );
  
  